//
//  MyQianCell.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/3/3.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "MyQianCell.h"

@implementation MyQianCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self createUI];
        
        UILabel *orageLab = [[UILabel alloc] init];
        orageLab.backgroundColor = OverColor;
        [self addSubview:orageLab];
        [orageLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(3, 45));
            make.left.mas_equalTo(self.mas_left).offset(1);
            make.top.equalTo(self.mas_top).offset(7);
            
        }];
        
        _photoImg= [[UIImageView alloc] init];
        _photoImg.image = [UIImage imageNamed:@"nanshihui"];
        [self addSubview:_photoImg];
        [_photoImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(17);
            make.top.equalTo(self.mas_top).offset(10);
            make.left.equalTo(self.mas_left).offset(10);
        }];
        
        _nameLab = [[UILabel alloc] init];
        _nameLab.text = @"欧阳浩";
        _nameLab.textColor = OverColor;
        _nameLab.font = [UIFont systemFontOfSize:14];
        [self addSubview:_nameLab];
        [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(60, 16));
            make.left.equalTo(_photoImg.mas_right).offset(6);
            make.top.mas_equalTo(self.mas_top).offset(12);
        }];
        
        _houseLab = [[UILabel alloc] init];
        _houseLab.textColor = [UIColor blackColor];
        _houseLab.text = @"认购房源 | 8号楼2单元1105";
        _houseLab.font = [UIFont systemFontOfSize:10];
        [self addSubview:_houseLab];
        [_houseLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(160, 14));
            make.left.equalTo(_nameLab.mas_right).offset(10);
            make.top.equalTo(self.mas_top).offset(13);
        }];
        
        
        _timeLab = [[UILabel alloc] init];
        _timeLab.text = @"认购日期 | 2016-11-29";
        _timeLab.textColor = [UIColor blackColor];
        _timeLab.font = [UIFont systemFontOfSize:10];
        [self addSubview:_timeLab];
        [_timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(110, 14));
            make.left.equalTo(self.mas_left).offset(15);
            make.top.equalTo(self.mas_top).offset(40);
        }];
        
        _qingLab = [[UILabel alloc] init];
        _qingLab.text = @"回款状态 |";
        _qingLab.textColor = [UIColor blackColor];
        _qingLab.font = [UIFont systemFontOfSize:10];
        [self addSubview:_qingLab];
        [_qingLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 14));
            make.left.equalTo(_timeLab.mas_right).offset(5);
            make.top.equalTo(self.mas_top).offset(40);
        }];
        
        
        _jiaoLao = [[UILabel alloc] init];
        _jiaoLao.text = @"未回款";
        _jiaoLao.textColor = [UIColor colorWithHexString:@"#53b279"];
        _jiaoLao.font = [UIFont systemFontOfSize:10];
        [self addSubview:_jiaoLao];
        [_jiaoLao mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(40, 14));
            make.left.equalTo(_qingLab.mas_right).offset(5);
            make.top.equalTo(self.mas_top).offset(40);
        }];

        
        _callBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _callBtn.layer.cornerRadius = 15;
        [_callBtn setImage:[UIImage imageNamed:@"dianhuatubiao"] forState:0];
        [_callBtn addTarget:self action:@selector(phoneBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_callBtn];
        [_callBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(35);
            make.top.equalTo(self.mas_top).offset(15);
            make.right.equalTo(self.mas_right).offset(-20);
        }];
        
   

        
    }
    return self;
}
//重点在这里
- (void)createUI{
    //创建一个UIView比self.contentView小一圈
    self.bgView  = [[UIView alloc] initWithFrame:CGRectMake(0,5, [[UIScreen mainScreen] bounds].size.width, 54)];
    self.bgView.backgroundColor = [UIColor whiteColor];
    //给bgView边框设置阴影
    self.bgView.layer.shadowOffset = CGSizeMake(2,2);
    self.bgView.layer.shadowOpacity = 0.8;
    self.bgView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    [self.contentView addSubview:self.bgView];
}

-(void)phoneBtnClick:(UIButton *)btn
{
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
